<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>2-正则命名分组</title>
</head>
<body>
    <script>
        // 声明一个字符串
        // let str = `<a href="http://www.atguigu.com">尚硅谷</a>`

        // 提取 url 与 标签文本
        // const reg = /<a href="(.*)">(.*)<\/a>/;

        // 执行
        // const result = reg.exec(str)
        // console.log(result);

        let str = `<a href="http://www.atguigu.com">尚硅谷</a>`
        const reg = /<a href="(?<url>.*)">(?<text>.*)<\/a>/;
        const result = reg.exec(str)
        console.log(result);
    </script>
</body>
</html>